Utertiguk


Anguniagaq 3: Peqqissuseq atugarissaarnerlu

Naartuersittarnerit


GS Arnat 12-it 49-llu akornanni ukiullit annertussusaat
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
SUDA2_raw <- 
  statgl_url("SUXA2", lang = "da") |>  
  statgl_fetch(.eliminate_rest = FALSE) |> 
  as_tibble() |> 
    rename(Aborter = value)

# Tidy
SUDA_2 <- 
  SUDA2_raw |> 
  as_tibble() |>  
  spread(enhed, Aborter) |> 
  mutate_at(c(1, 2), strtoi)

# Standardize
SUDA_2_2000 <- SUDA_2 |>  filter(tid == 2000) |>  pull(Middelfolketal)

SUDA2_std <- 
  SUDA_2 |> 
  group_by(tid) |>  
  summarise(age_adjust(Aborter, Middelfolketal, stdpop = SUDA_2_2000) * 1000)

# Plot
SUDA2_std |> 
  ggplot(aes(x = tid, y = std_rate)) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue"))+
  theme_statgl() +
  theme(plot.margin = margin(10, 10, 10, 10)) +
  labs(
    title    = sdg3$figs$fig1$title[language], 
    x        = " ", 
    y        = sdg3$figs$fig1$y_lab[language], 
    subtitle = sdg3$figs$fig1$sub[language],
    caption  = sdg3$figs$fig1$cap[language]
    )

Kisitsisaataasivik


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
SUDA2_raw <- 
  statgl_url("SUXA2", lang = "da") |>  
  statgl_fetch(.eliminate_rest = FALSE) |> 
  as_tibble() |> 
  rename(Aborter = value)

# Tidy
SUDA_2 <- 
  SUDA2_raw |> 
  as_tibble() |>  
  spread(enhed, Aborter) |>  
  mutate_at(c(1, 2), strtoi)

# Standardize
SUDA_2_2000 <- SUDA_2 |>  filter(tid == 2000) |>  pull(Middelfolketal)

SUDA2_std <- 
  SUDA_2 |> 
  group_by(tid) |>  
  summarise(age_adjust(Aborter, Middelfolketal, stdpop = SUDA_2_2000) * 1000,
            Aborter = sum(Aborter), Middelfolketal = sum(Middelfolketal))


vec        <- 2:5
names(vec) <- c(
    sdg3$figs$fig1$cols$col2[language],
    sdg3$figs$fig1$cols$col3[language],
    sdg3$figs$fig1$cols$col4[language],
    sdg3$figs$fig1$cols$col5[language]
    )

# Table
SUDA2_std |> 
  #arrange(desc(tid)) %>% 
  filter(tid > year(Sys.time()) - 7) |> 
  rename(vec) |> 
  gather(key, value, -tid) |>  
  mutate(
    key   = key |>  fct_inorder(),
    value = value |>  round(1),
    tid   = tid |>  factor(levels = unique(tid))
    ) |> 
  spread(1, 3) |>  
  rename(" " = 1) |>  
  statgl_table()
2018 2019 2020 2021 2022
Arnat 12-49 ukiullit 1000-iugaangata agguaqatigiisillugit naartumik katatsinerit 66,4 64,7 63,7 60,0 61,7
Ukiui malillugit annertussusaat 57,9 56,2 55,8 52,8 54,5
Naartumik katatsinerit 931,0 902,0 889,0 842,0 870,0
Agguaqatigiisillugu inuttussuseq 14.019,0 13.941,0 13.953,0 14.029,0 14.097,0
Kingullermik nutarterneqarfia 12. april 2024

Inuuneqqortussuseq


GS 0-iniit 1-inut ukiullit Kalaallit Nunaanni inunngorsimasut inuuneqqortussusaat
# Import
BEXBBDTB_raw <- 
  "BEXBBDTB" |>  
  statgl_url(lang = "da") |>  
  statgl_fetch(
    "place of birth" = "N",
    gender           = "t",
    age              = 0:1,
    calcbase         = "q5",
    measure          = "ex",
    time             = px_all(),
    .col_code        = TRUE
  ) |> 
  as_tibble()

# Plot
BEXBBDTB_raw |> 
  ggplot(aes(
    x     = as.numeric(time),
    y     = value,
    color = age
  )) +
  geom_line(size = 2) +
  theme_statgl() +
  scale_color_statgl() +
  scale_y_continuous(labels = scales::unit_format(
    suffix       = " ",
    big.mark     = ".",
    decimal.mark = ","
    )) +
  labs(
    title    = sdg3$figs$fig2$title[language],
    subtitle = sdg3$figs$fig2$sub[language],
    x        = " ",
    y        = BEXBBDTB_raw[["measure"]][[1]],
    color    = sdg3$figs$fig2$color[language],
    caption  = sdg3$figs$fig2$cap[language]
  )

Kisitsisaataasivik

Periaaseq


# Transform
tab <- 
  BEXBBDTB_raw |> 
  select(age, time, measure, calcbase, value) |>  
  unite(combi, measure, calcbase, sep = ", ") |>  
  filter(time >= max(as.numeric(time)) - 9) |> 
  spread(time, value)

# Table
tab |> 
  select(-combi) |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  pack_rows(index = tab[["combi"]] |>  table())
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
Middellevetid, 5 år
0 70,1 70,2 70,7 71,1 71,1 71,2 71,2 71,1 71,1 71,1
1 69,3 69,5 70,0 70,4 70,4 70,5 70,4 70,4 70,4 70,5

Toqusoqartarnera


GS Ukiut malillugit toqusoqartarnerata annertussusaa
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

 
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") |>  
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    .col_code = TRUE) |> 
  as_tibble() |> 
    rename(c(
      "alder"    = 1,
      "art"      = 2,
      "tid"      = 3,
      "Dødsfald" = 4
      ))

BEDBBM1 <- 
  BEDBBDM1_raw |>  
  as_tibble() |>  
  spread(art, Dødsfald) |>  
  mutate_at(1:2, strtoi) 

BEDBBM1_2000 <- 
  BEDBBM1 |>  
  filter(tid == 2000) |>  
  pull(Middelfolketal)

BEDBBM1_std <- BEDBBM1 |> 
  group_by(tid) |> 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBM1_2000) * 1000) |> 
  ungroup()

BEDBBM1_std |> 
  ggplot(aes(
    x = tid, 
    y = std_rate
    )) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue")) +
  theme_statgl() +
  labs(
    title    = sdg3$figs$fig4$title[language],
    subtitle = sdg3$figs$fig4$sub[language],
    y        = sdg3$figs$fig4$y_lab[language],
    x        = " ",
    caption  = sdg3$figs$fig4$cap[language]
  )

Kisitsisaataasivik

Periaaseq


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = "da") |> 
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    .col_code = TRUE) |> 
  as_tibble() |> 
    rename(c(
      "alder"    = 1,
      "art"      = 2,
      "tid"      = 3,
      "Dødsfald" = 4
      ))

BEDBBM1 <- 
  BEDBBDM1_raw |>  
  as_tibble() |>  
  spread(art, Dødsfald) |>  
  mutate_at(1:2, strtoi) 

BEDBBM1_2000 <- 
  BEDBBM1 |>  
  filter(tid == 2000) |>  
  pull(Middelfolketal)

BEDBBM1_std <- BEDBBM1 |> 
  group_by(tid) |> 
  summarise(age_adjust(Døde, Middelfolketal, stdpop = BEDBBM1_2000) * 1000) |> 
  ungroup()

vec <- 2:3
names(vec) <- c(
  sdg3$figs$fig4$cols$col2[language], 
  sdg3$figs$fig4$cols$col3[language]
  )

BEDBBM1_std |> 
  arrange(desc(tid)) |>  
  filter(tid > year(Sys.time()) - 7) |>  
  rename(vec) |> 
  gather(key, value, -tid) |>  
  mutate(
    tid   = tid |>  factor(levels = unique(tid)), 
    value = value |>  round(3)
    ) |> 
  spread(1, 3) |>  
  rename(" " = 1) |>  
  statgl_table()
2023 2022 2021 2020 2019 2018
Crude Rate 9,43 9,28 9,40 9,27 9,78 8,71
Std. Rate 5,38 5,60 5,79 5,70 6,07 5,43
# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  
  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = language) |> 
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    gender    = c("M", "K"),
    .col_code = TRUE) |> 
  as_tibble()

BEDBBDM1 <- 
  BEDBBDM1_raw |>  
  as_tibble() |>  
  spread(type, value) |>  
  mutate_at(c(1, 3), strtoi) |> 
  rename(c("Death" = 4, "Meanpopulation" = 5))

BEDBBDM1_2000 <- 
  BEDBBDM1 |>  
  arrange(time, gender, age) |>  
  filter(time == 2000) |>  
  pull(Meanpopulation)

BEDBBDM1_std <- 
  BEDBBDM1 |>  
  group_by(time, gender) |>  
  arrange(age) |>  
  summarise(age_adjust(Death, Meanpopulation, stdpop = BEDBBDM1_2000) * 1000) |>  
  ungroup()

BEDBBDM1_std |> 
  ggplot(aes(
    x     = time, 
    y     = std_rate, 
    color = gender
  )) +
  geom_line(size = 2) + 
  theme_statgl() +
  scale_color_statgl(reverse = TRUE) +
  labs(
    title    = sdg3$figs$fig5$title[language], 
    subtitle = sdg3$figs$fig5$sub[language],
    color    = " ", 
    x        = " ",
    y        = sdg3$figs$fig5$y_lab[language],
    caption  = sdg3$figs$fig4$cap[language]
  )

Kisitsisaataasivik

Periaaseq


# Helper function:
age_adjust <- function(count, pop, rate = NULL, stdpop){
  if (missing(count) & !missing(pop) & is.null(rate)) {
    count <- rate * pop
  }
  
  if (missing(pop) & !missing(count) & is.null(rate)) {
    pop <- count/rate
    pop[!is.finite(pop)] <- 0
  }
  
  if (is.null(rate) & !missing(count) & !missing(pop)){
    rate <- count/pop
    rate[!is.finite(rate)] <- 0
  }

  cruderate <- sum(count)/sum(pop)
  stdwt <- stdpop/sum(stdpop)
  dsr <- sum(stdwt * rate)
  
  tibble(`crude_rate` = cruderate, `std_rate` = dsr)
}

# Import
BEDBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = language) |> 
  statgl_fetch(
    type      = px_all(),
    age       = px_all(),
    gender    = c("M", "K"),
    .col_code = TRUE) |> 
  as_tibble()

BEDBBDM1 <- 
  BEDBBDM1_raw |>  
  spread(type, value) |>  
  mutate_at(c(1, 3), strtoi) |> 
  rename(c("Death" = 4, "Meanpopulation" = 5))

BEDBBDM1_2000 <- 
  BEDBBDM1 |>  
  arrange(time, gender, age) |>  
  filter(time == 2000) |>  
  pull(Meanpopulation)

BEDBBDM1_std <- 
  BEDBBDM1 |>  
  group_by(time, gender) |>  
  arrange(age) |> 
  summarise(age_adjust(Death, Meanpopulation, stdpop = BEDBBDM1_2000) * 1000) |> 
  ungroup()

vec        <- 2:3
names(vec) <- 
  c(
    sdg3$figs$fig4$cols$col2[language], 
    sdg3$figs$fig4$cols$col3[language]
    )

step <- 
  BEDBBDM1_std |> 
  filter(time > year(Sys.time()) - 5) |>  
  unite(combi, 1, 2, sep = ",") |> 
  rename(vec) |> 
  gather(key, value, -combi) |>  
  mutate(
    combi = combi |>  fct_inorder(),
    key   = key |>  fct_inorder(),
    value = value |>  round(3)
  ) |> 
  spread(1, 3)

vecvec   <- step[-1] |>  colnames() |>  str_split(",") |>  unlist()
head_vec <- vecvec[c(T, F)] |>  table()
col_vec  <- vecvec[c(F, T)]

step |> 
  rename(" " = 1) |>  
  statgl_table(
    col.names = c(" ", col_vec)
    ) |> 
  add_header_above(c(" ", head_vec))
2020
2021
2022
2023
2020,Angutit 2020,Arnat 2021,Angutit 2021,Arnat 2022,Angutit 2022,Arnat 2023,Angutit 2023,Arnat
Crude Rate 99.832 118.714 99.923 114.631 95.631 125.559 88.453 136.464
Std. Rate 74.432 70.433 94.469 96.049 101.568 77.195 87.731 75.868



Tuberkulose


FN 3.3.2 Innuttaasut 100.000-iugaangata tuberkulosemik tunillatsissimasut nutaat
# Import
DISE01_raw <- 
  "https://pxweb.nhwstat.org:443/Prod/sq/31c3d851-c0ad-4728-8ee0-9b2b252cc48b.csv" |> 
  read_csv() |> 
  as_tibble()

# Transform
DISE01 <- 
  DISE01_raw |> 
  pivot_longer(cols = c(`Greenland Men`, `Greenland Women`), names_to = "sex", values_to = "Greenland") |> 
  mutate(
    sex  = sex |>  str_replace("Greenland Men",   sdg3$figs$fig6$groups$group1[language] |>  unlist()),
    sex  = sex |>  str_replace("Greenland Women", sdg3$figs$fig6$groups$group2[language] |>  unlist()),
    Greenland = as.numeric(Greenland)
  ) |> 
  filter(Year > 2002)

# Plot
DISE01 |> 
  ggplot(aes(
    x     = Year,
    y     = Greenland,
    color = sex
  )) +
  geom_line(size = 2) +
  theme_statgl() +
  scale_color_statgl(reverse = TRUE) +
  labs(
    title    = sdg3$figs$fig6$title[language],
    subtitle = sdg3$figs$fig6$sub[language],
    x        = " ",
    y        = sdg3$figs$fig6$y_lab[language],
    color    = " ",
    caption  = sdg3$figs$fig6$cap[language]
  )

Tabel, NOMESCO


# Transform
DISE01 <- 
  DISE01_raw |> 
  pivot_longer(cols = c(`Greenland Men`, `Greenland Women`), names_to = "sex", values_to = "Greenland") |> 
  mutate(
    sex  = sex |>  str_replace("Greenland Men",   sdg3$figs$fig6$groups$group1[language] |>  unlist()),
    sex  = sex |>  str_replace("Greenland Women", sdg3$figs$fig6$groups$group2[language] |>  unlist())
  ) |> 
  filter(Year >= year(Sys.time()) - 7) |> 
  select(-`Greenland Men and Women`) |> 
  spread(1,3)

# Table
DISE01 |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  pack_rows(index = rep(sdg3$figs$fig6$index[language] |>  unlist(), length(DISE01[[1]])) |>  table()) |>  
  add_footnote(
    sdg3$figs$fig6$foot[language], 
    notation = "symbol"
  )
2017 2018 2019 2020 2021 2022
Tuberkulosemik napparsimasut
Angutit 132.5 119.5 187.3 .. .. ..
Arnat 91.8 96.3 86.5 .. .. ..
* Inuit 100.000-iugaangata

Imminut toquttarneq


FN 3.4.3 Imminut toquttarnerup annertussusaa
# Import
SUDLDM2_raw <- 
  read_csv(paste0("https://bank.stat.gl:443/sq/3efbaaab-3db0-4b90-8f7b-18c556afe4e4", "?lang=", language),
    locale = locale(encoding = "latin1"))

BEDSTM1_raw <- 
  read_csv(paste0("https://bank.stat.gl:443/sq/e8c2ed7c-ed03-471b-87e1-40d658b78bd4", "?lang=", language))

# Transform
Selvmord <-
  SUDLDM2_raw |> 
  left_join(BEDSTM1_raw) |>  
  rename(
    "cause"      = 1,
    "time"       = 2,
    "suicide"    = 3,
    "population" = 4
    ) |> 
  mutate(rate = suicide / population * 10^5,
         time = time |>  make_date()) |> 
  filter(rate > 0)

# Plot
Selvmord |> 
  ggplot(aes(
    x = time,
    y = rate,
    color = statgl:::statgl_cols("darkblue")
  )) +
  geom_line(size = 2) +
  theme_statgl() + scale_color_statgl() +
  theme(legend.position = "none") +
  labs(
    title   = Selvmord[[1]][1],
    x       = " ",
    y       = sdg3$figs$fig7$y_lab[language],
    caption = sdg3$figs$fig7$cap[language]
  )

Kisitsisaataasivik


# Transform
Selvmord <-
  SUDLDM2_raw |> 
  left_join(BEDSTM1_raw) |>  
  rename(
    "cause"      = 1,
    "time"       = 2,
    "suicide"    = 3,
    "population" = 4
    ) |> 
  mutate(rate = (suicide / population * 10^5) |>  round(2)) |>  
  #arrange(desc(time)) %>% 
  filter(rate > 0, 
         time >= year(Sys.time()) - 7) |> 
  select(-(3:4)) |> 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(2, 3)

# Table
Selvmord |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  add_footnote(
    sdg3$figs$fig7$foot[language], 
    notation = "symbol"
    )
2017 2018 2019 2020 2021 2022
Imminut toquttut/imminut toqoriartut 69,8 80,5 80,4 73,1 83,3 72,5
* Inuit 100.000-iugaangata

Meeraaqqat toqusarnerat


FN 3.2.1 Meeqqat tallimat inorlugit ukiullit akornanni toqusoqartarnera
# Import, dødelighed
BEXBBDM1_raw <-
  statgl_url("BEXBBDM1", lang = language) |> 
  statgl_fetch(
    age       = 0:4,
    type      = "D",
    .col_code = TRUE
    ) |> 
  as_tibble()

# Import, levendefødte
BEXBBLK1_raw <-
  statgl_url("BEXBBLK1", lang = language) |> 
  statgl_fetch(
    type      = "L",
    .col_code = TRUE
    ) |> 
  as_tibble()

child_mortality <-
  BEXBBDM1_raw |>  
  spread(2, 4) |>  
  spread(1, 3) |>  
  mutate(sum = `0` + `1` + `2` + `3` + `4`) |> 
  select(-(2:6)) |> 
  left_join(BEXBBLK1_raw |>  spread(1, 3)) |>  
  rename(
    "mortality"  = 2,
    "population" = 3
  ) |> 
  mutate(rate = mortality / population * 1000,
         time = time |>  make_date())

# Plot
child_mortality |> 
  ggplot(aes(
    x = time,
    y = rate,
    color = statgl:::statgl_cols("darkblue")
    )) +
  geom_line(size = 2, color = statgl:::statgl_cols("darkblue")) +
  expand_limits(y = 0) +
  theme_statgl() +
  labs(
    title    = sdg3$figs$fig8$title[language],
    subtitle = sdg3$figs$fig8$sub[language],
    x        = " ",
    y        = sdg3$figs$fig8$y_lab[language],
    caption  = sdg3$figs$fig8$cap[language]
  )

Kisitsisaataasivik


# Transform
child_mortality <-
  BEXBBDM1_raw |>  
  spread(2, 4) |>  
  spread(1, 3) |>  
  mutate(sum = `0` + `1` + `2` + `3` + `4`) |> 
  select(-(2:6)) |> 
  left_join(BEXBBLK1_raw |>  spread(1, 3)) |>  
  rename(
    "mortality"  = 2,
    "population" = 3
    ) |> 
  mutate(rate = mortality / population * 1000,
         rate = rate %>% round(3)) |>  
  select(-(2:3)) |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time)),
         var = sdg3$figs$fig8$cols$col3[language]) |>  
  spread(1, 2)

# Table
child_mortality |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  add_footnote(
    sdg3$figs$fig8$foot[language], 
    notation = "symbol"
    )
2019 2020 2021 2022 2023
Meeraaqqat toqusarnerat 14,1 12 15,8 13,4 12,6
* Uumallutik inunngortut tuusintiugaangata toqusartut annertussusaat

Imigassaq tupalu


FN 3.5.2 14-ileereersimasunut imigassamik pilersuineq
url <- paste0("https://bank.stat.gl:443/api/v1/", language, "/Greenland/AL/AL10/ALXALK1.px")

# Import
ALXALK1_raw <-
  url |> 
  statgl_fetch(
    unit      = 1,
    type      = 0:2,
    category  = 1,
    .col_code = TRUE
    ) |> 
  as_tibble()

# Transform
ALXALK1 <-
  ALXALK1_raw |>  
  mutate(time = time |>  make_date())
  
# Plot
ALXALK1 |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = type
    )) +
  geom_area() +
  theme_statgl() +
  scale_fill_statgl(palette = "autumn") +
  labs(
    title    = sdg3$figs$fig9$title[language],
    subtitle = sdg3$figs$fig9$sub[language],
    x        = " ",
    y        = sdg3$figs$fig9$y_lab[language],
    fill     = sdg3$figs$fig9$fill[language],
    caption  = sdg3$figs$fig9$cap[language]
  )

Kisitsisaataasivik

Periaaseq


# Transform
ALXALK1 <-
  ALXALK1_raw |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(4, 5)

# Table
ALXALK1 |> 
  select(-c(1, 3)) |>  
  rename(" " = 1) |> 
  statgl_table() |> 
  pack_rows(index = table(ALXALK1[[3]]))
2019 2020 2021 2022 2023
Liter inummut 15-ileereersimasumut ataatsimut
Immiaaqqat 5,54 6,31 6,28 5,86 6,26
Kimittuut 0,64 0,77 0,86 0,87 0,81
Viinni 1,43 1,68 1,65 1,52 1,43
FN 3.a.1 14-ileereersimasumut ullormut tupanik eqqussuineq
url <- paste0("https://bank.stat.gl:443/api/v1/", language, "/Greenland/AL/AL40/ALXTOB2.px")

# Import
ALXTOB2_raw <-
  url |> 
  statgl_fetch(
    unit      = 3,
    type      = 0:1,
    .col_code = TRUE
    ) |> 
  as_tibble()

  
# Transform
ALXTOB2 <-
  ALXTOB2_raw |> 
  mutate(time = time |>  make_date())

# Plot
ALXTOB2 |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = type
    )) +
  geom_area() +
  theme_statgl() +
  theme(plot.margin = margin(10, 10, 10, 10)) +
  scale_fill_statgl(palette = "autumn") +
  scale_y_continuous(labels = scales::comma_format(
    decimal.mark = ",", 
    big.mark     = "."
    )) +
  labs(
    title    = sdg3$figs$fig10$title[language],
    subtitle = sdg3$figs$fig10$sub[language],
    x        = " ",
    y        = sdg3$figs$fig10$y_lab[language],
    fill     = sdg3$figs$fig10$fill[language],
    caption  = sdg3$figs$fig10$cap[language]
  )

Kisitsisaataasivik

Periaaseq


# Transform
ALXTOB2 <-
  ALXTOB2_raw |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(2, 4)

# Table
ALXTOB2 |> 
  select(-1) |>  
  rename(" " = 1) |>  
  statgl_table() |> 
  pack_rows(index = table(ALXTOB2[[1]]))
2019 2020 2021 2022 2023
Inummut 15-leereersimasumut agg. ullormut stk.
Immussat 2,91 2,46 2,40 2,13 1,78
Sikaritsit nalinginnaasut 2,75 3,28 2,82 3,02 3,20

Pisortanit peqqinnissaqarfimmi atorfillit


FN 3.c.1 Pisortanit peqqinnissaqarfimmi atorfillit
# Import
OFXOA1_raw <-
  statgl_url("OFXOA1", lang = language) |> 
  statgl_fetch(
    `inventory variable` = px_all(),
    .col_code            = TRUE
    ) |> 
  as_tibble()

# Transform
OFXOA1 <-
  OFXOA1_raw |>  
  mutate(
    time  = time |>  make_date(),
    value = value * 10^-3
    )

# Plot
OFXOA1 |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = `inventory variable`
  )) +
  geom_col(position = "dodge") +
  theme_statgl() + 
  scale_fill_statgl(reverse = TRUE) +
  labs(
    title   = sdg3$figs$fig11$title[language],
    x       = " ",
    y       = sdg3$figs$fig11$y_lab[language],
    fill    = " ",
    caption = sdg3$figs$fig11$cap[language]
  )

Kisitsisaataasivik

Periaaseq


# Transform
OFXOA1 <- 
  OFXOA1_raw |> 
  #arrange(desc(time)) %>% 
  filter(time >= year(Sys.time()) - 5) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(1, 3)

# Table
OFXOA1 |> 
  rename(" " = 1) |>  
  statgl_table() |> 
  add_footnote(
    sdg3$figs$fig11$foot[language], 
    notation = "symbol"
    )
2019 2020 2021 2022
Atorfillit 18.976 18.691 18.909 18.990
Piffissaq tamakkerlugu sulisut 10.872 11.066 11.279 11.224
* Peqqinnissaqarfimmiittut amerlassusaat

Inunngornermi oqimaassuseq


GS Inunngornermi oqimaassuseq
# Import
BEDLL1_raw <- 
  statgl_url("BEXLL1", lang = language) |>  
  statgl_fetch(
    time      = px_all(),
    weight    = 0:9,
    .col_code = TRUE
  ) |> 
  as_tibble()

# Transform
BEDLL1 <- 
  BEDLL1_raw |>  
  mutate(
    time   = time |>  as.numeric(),
    weight = weight |>  str_remove("gram") |>  trimws(),
    weight = weight |>  factor(levels = unique(weight))
  ) |> 
  filter(time %in% quantile(time)[-1])

# Plot
BEDLL1 |> 
  ggplot(aes(
    x    = weight,
    y    = value,
    fill = time |>  as.factor()
  )) +
  geom_col(position = "dodge2") +
  theme_statgl() + 
  theme(text = element_text(size = 20)) +
  scale_fill_statgl() +
  labs(
    title   = sdg3$figs$fig12$title[language],
    x       = sdg3$figs$fig12$x_lab[language],
    y       = sdg3$figs$fig12$y_lab[language],
    fill    = " ",
    caption = sdg3$figs$fig12$cap[language]
  )

Kisitsisaataasivik




# Table
BEDLL1_raw |> 
  mutate(
    time   = time   |>  as.numeric(),
    weight = weight |>  factor(levels = unique(weight))
  ) |> 
  filter(time %in% quantile(time)[-1]) |>  
  arrange(desc(time)) |> 
  mutate(time = time |> factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig12$foot[language], notation = "symbol")
2010 2005 2000 1995
Under 1000 gram 3 1 3 2
1000-1499 gram 5 1 4 15
1500-1999 gram 15 8 5 7
2000-2499 gram 32 22 15 34
2500-2999 gram 83 119 91 129
3000-3499 gram 293 275 289 340
3500-3999 gram 273 303 294 361
4000-4499 gram 124 118 138 169
4500-4999 gram 31 33 34 36
Over 5000 gram 5 5 2 6
* Inuit amerlassusaat

Aanngajaarniutit


GS Aanngajaarniutit
# Import 
a <- c(3, 6, 16, 37, 49, 56, 3, 8, 24, 37, 52, 55, 2, 2, 6, 25, 43, 49, 1.5, 2, 6, 15, 26, 52)
b <- rep(c(11, 12, 13, 14, 15, 16), 4)
c <- c(rep(2006, 6), rep(2010, 6), rep(2014, 6), rep(2018, 6))

# Transform
hbsc <-
  data.frame(a, b, c) |> 
  as_tibble() |> 
  rename(
    "value" = 1,
    "age"   = 2,
    "time"  = 3
    ) |> 
  mutate(age = age |>  factor(levels = unique(age)))

# Plot  
hbsc |> 
  ggplot(aes(
    x = age,
    y = value,
    fill = age
  )) +
  geom_col() +
  facet_wrap(~ time) +
  xlab("age") +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  theme(legend.position = "none") +
  labs(
    title   = sdg3$figs$fig13$title[language],
    x       = sdg3$figs$fig13$x_lab[language],
    y       = " ",
    caption = sdg3$figs$fig13$cap[language]
  )

HBSC-mik misissuineq


vec        <- 1
names(vec) <-  sdg3$figs$fig13$x_lab[language]
  
# Table
hbsc |> 
  arrange(desc(time)) |>  
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |>  
  rename(vec) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig13$foot[language], notation = "symbol")
Ukiut 2018 2014 2010 2006
11 1,5 2 3 3
12 2,0 2 8 6
13 6,0 6 24 16
14 15,0 25 37 37
15 26,0 43 52 49
16 52,0 49 55 56
* 11-16-inik ukiullit akornanni ullut tamaasa pujortartartut procentinngorlugit (2018-imi N=2.085)
key1 <- sdg3$figs$fig14$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig14$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig14$keys$key3[language] |>  unlist()


  
# Import
a <- c(6, 3, 4, 2, 3, 2)
b <- rep(c(2014, 2018), 3)
c <- c(rep(key1, 2), rep(key2, 2), rep(key3, 2))

hbsc <- 
  data.frame(b, a, c) |> 
  as_tibble() |> 
  rename(
    "time" = 1,
    "value" = 2,
    "key" = 3
  ) |> 
  mutate(
    key  = key  |>  factor(levels = unique(key)),
    time = time |>  factor(levels = unique(time))
    )

# Plot
hbsc |> 
  ggplot(aes(
    x = time,
    y = value,
    fill = time
  )) +
  geom_col() +
  facet_wrap(~ key) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  theme(legend.position = "none") +
  xlab("time") +
  labs(
    title   = sdg3$figs$fig14$title[language],
    y       = " ",
    x       = " ",
    caption = sdg3$figs$fig14$cap[language]
  )

HBSC-mik misissuineq


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig14$foot[language], notation = "symbol")
2014 2018
Minnerpaamik ataasiarluni naamaarsimavoq 6 3
Qaammatini kingullerni 12-ini naamaartarsimavoq 4 2
Ulluni kingullerni 30-ni naamaartarsimavoq 3 2
* 11-17-inik ukiullit akornanni inuunertik naallugu,
qaammatini kingullerni 12-ini aamma ulluni kingullerni 30-ni naamaartarsimasut annertussusaat (N=1.931-2.013).
key1 <- sdg3$figs$fig15$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig15$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig15$keys$key3[language] |>  unlist()

  
  
# Import 
a <- c(27, 15, 17, 12, 9, 8)
b <- rep(c(2014, 2018), 3)
c <- c(rep(key1, 2), rep(key2, 2), rep(key3, 2))

# Transform
hbsc <-
  data.frame(b, c, a) |>  
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(
    key  = key  |>  factor(levels = unique(key)),
    time = time |>  factor(levels = unique(time))
    )

# Plot
hbsc |> 
  ggplot(aes(
    x    = time,
    y    = value,
    fill = key
  )) +
  geom_col() +
  facet_wrap(~ key) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  theme(legend.position = "none") +
  labs(
    title   = sdg3$figs$fig15$title[language],
    y       = " ",
    x       = " ",
    caption = sdg3$figs$fig15$cap[language]
  )

HBSC-mik misissuineq


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig15$foot[language], notation = "symbol")
2014 2018
Minnerpaamik sapaatip akunneranut ataasiarluni hashitortarsimavoq 27 15
Qaammatini kingullerni 12-ini hashitortarsimavoq 17 12
Ulluni kingullerni 30-ni hashitortarsimavoq 9 8
* 15-17-inik ukiullit akornanni hashimik misiliisimanermik,
qaammatini kingullerni 12-ini aamma ulluni kingullerni 30-ni hashitortarsimanerminnik nalunaarsimasut annertussusaat (2018-imi N=329)
# Import 
a <- c(92,90,82,56,35,24,89,84,70,52,29,21,80,83,82,82,80,74,98,98,96,84,68,51)
b <- c(rep(2006, 6), rep(2010, 6), rep(2014, 6), rep(2018, 6))
c <- rep(11:16, 4)

# Transform
hbsc <- 
data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    time  = 1,
    age   = 2,
    value = 3
  ) |> 
  mutate(
    time = time |> factor(levels = unique(time)),
  )

# Plot
hbsc |> 
  ggplot(aes(
    x = age,
    y = value,
    color = time
  )) +
  geom_line(size = 2) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_color_statgl() +
  labs(
    title   = sdg3$figs$fig16$title[language],
    y       = sdg3$figs$fig16$y_lab[language],
    x       = sdg3$figs$fig16$x_lab[language],
    color   = " ",
    caption = sdg3$figs$fig16$cap[language]
  )

HBSC-mik misissuineq


  hbsc |> 
  arrange(desc(time)) |>  
  mutate(time = time |> factor(levels = unique(time))) |> 
  spread(time, value) |> 
  rename("Alder" = 1) |> 
  statgl_table() |>  
  add_footnote(sdg3$figs$fig16$foot[language], notation = "symbol")
Alder 2018 2014 2010 2006
11 98 80 89 92
12 98 83 84 90
13 96 82 70 82
14 84 82 52 56
15 68 80 29 35
16 51 74 21 24
* Aalakoorimanngisaanartut 2006-imiit
2018-imut annertussusaasa iniartornerat

Timimik aalatitsineq


GS Timimik aalatitsineq
# Import
key1 <- sdg3$figs$fig17$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig17$keys$key2[language] |>  unlist()

a <- c(33, 30, 27, 24, 24, 24, 15, 18)
b <- rep(c(2006, 2010, 2014, 2018), 2)
c <- c(rep(key1, 4), rep(key2, 4))

# Transform
hbsc <-
  data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"   = 1,
    "gender" = 2,
    "value"  = 3
  ) |> 
  mutate(gender = gender |> factor(levels = unique(gender)))

# Plot
hbsc |> 
  ggplot(aes(
    x     = time,
    y     = value,
    color = gender
  )) +
  geom_line(size = 2) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_color_statgl() +
  labs(
    title   = sdg3$figs$fig17$title[language],
    y       = sdg3$figs$fig17$y_lab[language],
    x       = " ",
    color   = " ",
    caption = sdg3$figs$fig17$cap[language]
  )

HBSC-mik misissuineq


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |> 
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig17$foot[language], notation = "symbol")
2006 2010 2014 2018
Nukappiaqqat 33 30 27 24
Niviarsiaqqat 24 24 15 18
* 2006-2018-umut 60 minutsinik ullormut akunnattumik timimik atuisarneq suiaassutsinut immikkoortillugit procentinngortillugit (2018-imi N=2.075)

Timimik paasinninneq


GS Timimik paasinninneq
# Import
key1 <- sdg3$figs$fig18$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig18$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig18$keys$key3[language] |>  unlist()
key4 <- sdg3$figs$fig18$keys$key4[language] |>  unlist()
key5 <- sdg3$figs$fig18$keys$key5[language] |>  unlist()

a <- c(3,3, 11,9,57,58,26,26,3,4)
b <- c(rep(key1, 2), rep(key2, 2), rep(key3, 2), rep(key4, 2), rep(key5, 2))
c <- rep(c(2014, 2018), 5)

# Transform
hbsc <- 
  data.frame(c, b, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(
    time = time |> factor(levels = unique(time)),
    key  = key  |> factor(levels = unique(key))
    )

# Plot
hbsc |> 
  ggplot(aes(
    x = key,
    y = value,
    fill = time
  )) +
  geom_col(position = "dodge2") +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl() +
  labs(
    title   = sdg3$figs$fig18$title[language],
    y       = " ",
    x       = " ",
    fill    = " ",
    caption = sdg3$figs$fig18$cap[language]
  )

HBSC-mik misissuineq


# Table
hbsc |> 
  arrange(desc(time)) |> 
  mutate(time = time |> factor(levels = unique(time))) |> 
  spread(time, value) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig18$foot[language], notation = "symbol")
key 2018 2014
Saluppallaartoq 3 3
Saluppallaalaartoq 9 11
Naammaginartoq 58 57
Pualavallaalaartoq 26 26
Pualavallaartoq 4 3
* Timimik iluarisimaarinninneq procentinngorlugu (2018-imi N=1.871).

Sodavandi


GS Sodavandi
# Import
key1 <- sdg3$figs$fig19$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig19$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig19$keys$key3[language] |>  unlist()

a <- c(32,22,20,23,14,35,38,34,9,31,44,41,42,13,35)
b <- rep(c(2002,2006,2010,2014,2018), 3)
c <- c(rep(key1, 5), rep(key2, 5), rep(key3, 5))

# Transform
hbsc <- 
data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(key = key |> factor(levels = unique(key)))

# Plot
hbsc |> 
  ggplot(aes(
    x     = time,
    y     = value,
    color = key
  )) +
  geom_line(size  = 2) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_color_statgl() +
  labs(
    title   = sdg3$figs$fig19$title[language],
    x       = " ",
    y       = " ",
    color   = " ",
    caption = sdg3$figs$fig19$cap[language] 
  )

HBSC-mik misissuineq


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |> factor(levels = unique(time))) |> 
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig19$foot[language], notation = "symbol")
2002 2006 2010 2014 2018
Nuuk 32 22 20 23 14
Illoqarfinni allani 35 38 34 9 31
Nunaqarfinni 44 41 42 13 35
* 2002-miit 2018-imut atuartut sodavandinik sukkutalinnik ullormut imertartut annertussusaat.

Kigutigissarneq


GS Kigutigissarneq
# Import

key1 <- sdg3$figs$fig20$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig20$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig20$keys$key3[language] |>  unlist()

a <- c(50,31,19,61,24,16,63,27,10,64,28,8)
b <- rep(c(2006,2010,2014,2018), 3)
c <- rep(c(key1, key2, key3), 4)

# Transform
hbsc <- 
  data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(
    key  = key |>  factor(levels = unique(key)),
    time = time |>  factor(levels = unique(time))
  )

# Plot
hbsc |> 
  ggplot(aes(
    x = key,
    y = value,
    fill = key
  )) +
  geom_col() +
  facet_wrap(~ time, nrow = 1) +
  scale_y_continuous(labels  = scales::percent_format(
    scale        = 1,
    big.mark     = ".",
    decimal.mark = ","
  )) +
  theme_statgl() + 
  scale_fill_statgl(guide = guide_legend(nrow = 3)) +
  theme(axis.text.x  = element_blank()) +
  labs(
    title   = sdg3$figs$fig20$title[language],
    y       = " ",
    x       = " ",
    fill    = " ",
    caption = sdg3$figs$fig20$cap[language]
  )

HBSC-mik misissuineq


# Table
hbsc |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote()
2006 2010 2014 2018
Sapaatip akunneranut ataatsimit amerlanerusut 50 64 63 61
Ullormut ataaseq 24 31 28 27
Ullormut ataasianermit akuttunerusoq 10 16 19 8

Oqarasuaatikkut siunnersuisarfiit


GS Oqarasuaatikkut siunnersuisarfiit
# Import
key1 <- sdg3$figs$fig21$keys$key1[language] |>  unlist()
key2 <- sdg3$figs$fig21$keys$key2[language] |>  unlist()
key3 <- sdg3$figs$fig21$keys$key3[language] |>  unlist()
key4 <- sdg3$figs$fig21$keys$key4[language] |>  unlist()

a <- c(1732, 272, 547,  1485, 1887, 382, 668, 1609, 636, 106, 182, 560)
b <- c(rep(2019, 4), rep(2020, 4), rep(2021, 4))
c <- rep(c(key1, key2, key3, key4), 3)

# Transform
tusaannga <- 
  data.frame(b, c, a) |> 
  as_tibble() |> 
  rename(
    "time"  = 1,
    "key"   = 2,
    "value" = 3
  ) |> 
  mutate(key = key |>  factor(levels = unique(key)))

tusaannga |> 
  filter(!key %in% c(key1, key2)) |>  
  ggplot(aes(
    x = time,
    y = value,
    fill = key
  )) +
  geom_col() +
  theme_statgl() + 
  scale_fill_statgl(reverse = TRUE) +
  labs(
    title    = sdg3$figs$fig21$title[language],
    subtitle = sdg3$figs$fig21$sub[language],
    x        = " ",
    y        = sdg3$figs$fig21$y_lab[language],
    fill     = " ",
    caption  = sdg3$figs$fig21$cap[language]
  )


# Table
tusaannga |> 
  #arrange(desc(time)) %>% 
  mutate(time = time |>  factor(levels = unique(time))) |>  
  spread(1, 3) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig21$foot[language], notation = "symbol")
2019 2020 2021
Inersimasoq 1.732 1.887 636
Meeqqat 272 382 106
SMS 547 668 182
Sianerluni 1.485 1.609 560
* 2021-imut kisitsisit januarip aallaqqaataaniit 23. apriilimut atuupput.

Ilaqutariinni paarsisartuniinneq


GS Ilaqutariinni paarsisartuniinneq
# Import
SOXPV003_raw <- 
  statgl_url("SOXPV003", lang = language) |> 
  statgl_fetch(
    "first adress in greenland" = px_all(),
    year                        = px_top(3),
    .col_code                    = TRUE
  ) |> 
  as_tibble()

# Transform
SOXPV003 <- 
  SOXPV003_raw |> 
  filter(`first adress in greenland` != SOXPV003_raw[[1]][1]) |> 
  mutate(
    year                        = year |>  as.numeric(),
    `first adress in greenland` = `first adress in greenland` |>  fct_reorder(value, sum)
    )

# Plot
SOXPV003 |> 
  ggplot(aes(
    x = `first adress in greenland`,
    y = value,
    fill = year
  )) +
  geom_col() +
  coord_flip() +
  theme_statgl() + 
  scale_color_statgl() +
  theme(legend.position = "none") +
  facet_wrap(~ year) +
  labs(
    title   = statgl_meta(statgl_url("SOXPV003", lang = language))[1],
    x       = statgl_meta(statgl_url("SOXPV003", lang = language))[2]$variables[[1]]$text |>  str_to_title(),
    y       = sdg3$figs$fig22$y_lab[language],
    caption = sdg3$figs$fig22$cap[language]
  )

Kisitsisaataasivik


# Table
x_lab        <- 1
names(x_lab) <- statgl_meta(statgl_url("SOXPV003", lang = language))[2]$variables[[1]]$text |>  str_to_title()

tab <- 
  SOXPV003 |> 
  mutate(
    `first adress in greenland` = `first adress in greenland` |>  fct_rev(),
    year = year |>  factor(levels = unique(year)) |>  fct_rev()
    ) |> 
  spread(2, 3)

tab |> 
  rename(x_lab) |> 
  statgl_table() |> 
  add_footnote(sdg3$figs$fig22$foot[language], notation = "symbol")
Kalaallit Nunaanni Adresse Siulleq 2023 2022 2021
Tasiilaq 81 73 65
Nuuk 47 53 61
Ilulissat 37 36 39
Sisimiut 32 35 40
Qaqortoq 40 31 31
Maniitsoq 36 25 24
Nanortalik 31 25 24
Aasiaat 17 20 17
Paamiut 11 19 18
Narsaq 18 14 13
Qasigiannguit 12 12 16
Upernavik 13 12 13
Qaanaaq 9 14 13
Kangaatsiaq 9 12 10
Qeqertarsuaq 11 12 6
Uummannaq 5 5 5
Ittoqqortoormiit NA 2 3
* Meeqqat amerlassusaat
# Import
SOXPV001_raw <- 
  statgl_url("SOXPV001", lang = language) |> 
  statgl_fetch(
    unit               = c("Aarsvaerk"),
    "age of the child" = 0:19,
    year               = px_top(3),
    .col_code          = TRUE
    ) |> 
  as_tibble()

# Transform
SOXPV001 <- 
  SOXPV001_raw |> 
  mutate(
    year = year |>  as.numeric(),
    `age of the child` = `age of the child` |>  factor(levels = unique(`age of the child`))
    )

# Plot
SOXPV001 |> 
  ggplot(aes(
    x = `age of the child`,
    y = value,
    fill = year
  )) +
  geom_col() +
  facet_wrap(~ year) +
  coord_flip() +
  theme_statgl() + 
  scale_color_statgl() +
  theme(legend.position = "none") +
  labs(
    title    = statgl_meta(statgl_url("SOXPV001", lang = language))[1],
    subtitle = str_to_sentence(SOXPV001_raw[[1]][1]),
    x        =  str_to_sentence(statgl_meta(statgl_url("SOXPV001", lang = language))[2]$variables[[2]]$text),
    y        = sdg3$figs$fig23$y_lab[language],
    caption  = sdg3$figs$fig23$cap[language]
  )

Kisitsisaataasivik


# Table
age_lab        <- 1
names(age_lab) <- str_to_sentence(statgl_meta(statgl_url("SOXPV001", lang = language))[2]$variables[[2]]$text)

foot <- 

tab <- 
  SOXPV001 |> 
  mutate(year = year |>  factor(levels = unique(year)) |>  fct_rev()) |>  
  spread(3, 4)

tab |> 
  select(-1) |>  
  rename(age_lab) |>  
  statgl_table() |> 
  add_footnote(paste0(sdg3$figs$fig23$foot[language], SOXPV001_raw[[1]][1]), notation = "symbol")
Meeqqap ukiui 2023 2022 2021
0 1,5 1,5 2,8
1 9,7 9,2 15,3
2 13,4 19,3 18,8
3 20,8 22,6 21,3
4 25,8 24,5 24,4
5 27,3 27,8 22,9
6 25,9 25,2 20,2
7 28,5 22,4 12,1
8 23,3 14,4 24,3
9 15,3 23,5 20,7
10 25,0 24,2 28,1
11 28,6 24,9 19,3
12 28,1 19,5 24,8
13 22,5 25,7 23,5
14 23,0 17,1 26,4
15 19,0 22,0 15,3
16 15,3 11,8 17,3
17 9,7 20,5 22,3
18 19,0 17,2 22,1
19+ 23,8 24,3 14,7
* Meeqqat amerlassusaatukiumut ilivitsumut iluarsisat

Nappaatip suussusaa


GS Nappaatip suussusaa
diag_cat <- 
  c(
    'F00: Uspec. fysisk handicap',
    'F01: Synstab',
    'F02: Høretab',
    'F03: Epilepsi',
    'F04: Stofskifte',
    'F05: Andre progressive lidelser',
    'F06: Gigt',
    'F07: Genetiske & medfødte',
    'F08: Indre organer',
    'F09: Hudlidelse,vansiring',
    'F10: Åndedræt',
    'F11: Kredsløb',
    'F12: Bevægeapparat',
    'F13: Hjerneskade',
    'F14: Immunforsvar',
    'F15: Andre handicaps',
    'F16: Talehandicap',
    'P00: Uspec. psykisk handicap',
    'P01: Mental retardering',
    'P02: Organiske psykiske lidelser',
    'P03: Misbrug',
    'P04: Udviklingsforstyrrelse',
    'P05: Personlighedsforstyrrelse',
    'P06: Psykotiske lidelser',
    'P07: Andre psykiske lidelser'
  )

SOXFO11_raw <- 
  statgl_url("SOXFO11", lang = language) |> 
  statgl_fetch(
    time                 = px_all(),
    "diagnosis Category" = diag_cat,
    .col_code            = TRUE
  ) |> 
  as_tibble()


if (language == "da") {
  
  f <- "Fysisk handicap"
  p <- "Psykisk handicap"
  
} else if (language == "kl") {

  f <- "Timikkut innarluuteqarneq"
  p <- "Tarnikkut innarluuteqarneq"
  
} else {

  f <- "Physical disability"
  p <- "Mental disability"
  
}

vec        <- c("F", "P")
names(vec) <- c(f, p)

SOXFO11 <- 
  SOXFO11_raw |> 
  separate(`diagnosis Category`, into = c("type", "cat")) |> 
  select(-cat) |> 
  mutate(type = type |>  str_remove_all("[:digit:]")) |> 
  group_by(type, time) |> 
  summarise(value = sum(value, na.rm = TRUE)) |> 
  ungroup() |> 
  spread(type, value) |> 
  rename(vec) |> 
  gather(key, value, -time) |> 
  mutate(key = key |>  fct_reorder(value, .fun = sum, .desc = FALSE))

SOXFO11 |> 
  ggplot(aes(
    x    = time, 
    y    = value,
    fill = key
  )) +
  geom_col() +
  theme_statgl() + 
  scale_fill_statgl() +
  labs(
    title    = sdg3$figs$fig24$title[language],
    subtitle = sdg3$figs$fig24$sub[language],
    y        = " ",
    x        = " ",
    fill     = " ",
    caption  = sdg3$figs$fig24$cap[language]
  )

Kisitsisaataasivik


SOXFO11 |> 
  mutate(
    time = time |>  fct_rev(),
    key = key |>  fct_reorder(value, sum) |>  fct_rev()
    ) |> 
  spread(time, value) |> 
  rename(" " = 1) |> 
  statgl_table() |> 
  kableExtra:: add_footnote(sdg3$figs$fig24$foot[language], notation = "symbol")
2018
Tarnikkut innarluuteqarneq 825
Timikkut innarluuteqarneq 561
* Inuit amerlassusaat

Kinguaassiuutitigut nappaatit

FN 3.7.1 Kinguaassiutitigut nappaatit 15-it 24-llu akornanni ukiullit amerlassusaat
url <- paste0("https://bank.stat.gl:443/api/v1/", language, "/Greenland/SU/SU01/SU0120/SUXLSKS1.px")

# Import
SUXLSKS1_raw <- 
  url |>
  statgl_fetch(
    age       = 15:24,
    disease   = 1:3,
    sex       = px_all(),
    time      = px_top(5),
    .col_code = T
  ) |> 
  as_tibble()

# Transform

SUXLSKS1 <- 
  SUXLSKS1_raw |> 
  group_by(disease, sex, time) |> 
  summarise(value = sum(value)) |> 
  ungroup() |> 
  arrange(disease, time) |> 
  unite(combi, disease, sex, sep = " ") |> 
  mutate(combi = fct_inorder(combi))

# Plot
SUXLSKS1 |> 
  ggplot() +
    geom_col(aes(
      x     = time,
      y     = value,
      fill  = combi
     ),
     position = "dodge"
    ) +
  scale_fill_statgl(guide = guide_legend(ncol = 3)) +
  theme_statgl() +
  labs(
    title    = sdg3$figs$fig25$title[language],
    subtitle = sdg3$figs$fig25$sub[language],
    x       = " ",
    y       = " ",
    fill    = " ",
    caption = sdg3$figs$fig25$cap[language]
  )

Kisitsisaataasivik


tabel <- 
  SUXLSKS1_raw |> 
  filter(time >= year(Sys.time()) - 7) |> 
  group_by(disease, sex, time) |> 
  summarise(value = sum(value)) |> 
  ungroup() |> 
  arrange(sex) |>  
  mutate(vec = sex) |> 
  unite(combi, disease, sex, sep = " ") |> 
  mutate(combi = fct_inorder(combi)) |> 
  spread(time, value)
  

tabel |> 
  rename(" " = 1) |> 
  select(-vec) |> 
  statgl_table() |> 
  pack_rows(index = table(tabel[[2]])) |> 
  add_footnote(sdg3$figs$fig25$foot[language], notation = "symbol")
2018 2019 2020 2021 2022
Angutit
Gonorré Angutit 240 322 334 413 499
Klamydia Angutit 606 548 557 543 524
Syfilis Angutit NA NA NA NA NA
Arnat
Gonorré Arnat 341 564 668 688 771
Klamydia Arnat 1.256 1.133 1.094 1.095 1.051
Syfilis Arnat 42 30 45 NA NA
Katillugit
Gonorré Katillugit 581 886 1.002 1.101 1.270
Klamydia Katillugit 1.862 1.681 1.651 1.638 1.575
Syfilis Katillugit 62 48 66 NA NA
* Inuit amerlassusaat